package com.chixing.day02_switch_case;

public class StringDemo {
    public static void main(String[] args) {
        String result = "https://search.51job.com";
                //workyear=02&cotype=99&degreefrom=03&jobterm=99&companysize=99&ord_field=0&dibiaoid=0&line=&welfare=
        String[] workYearArr = {"所有","在校生/应届生","1-3年","3-5年","5-10年","10年以上","无需经验"};
        String[] salaryArray = {"所有","2k以下","2-4k","4-5k","5-7k","7-9k","9-10k","10k以上"};
        String[] degreeArray = {"所有","初中及以下","高中/中专/大专","本科","硕士","博士","无学历要求"};
        String[] companyTypeArray = {"所有","国企","外资","上市公司","合资","民营企业","央企"};

        int workYear = 1;  // 选择了 "在校生/应届生"
        int salary = 2;   // 选择了 "2-4k"
        int degree = 1;   // 选择了 "硕士"
        int companyType = 2; // 选择了 "外资"

        //result += "?workYear=在校生/应届生&minsalary=2000&maxsalary=4000&degree=硕士&companyType=外资";
        if (workYear+salary+degree>0)
            result+="?";

        if(workYear>0 && workYear<workYearArr.length)
            result+="workYear="+workYearArr[workYear]+"&";

        if (salary >1 && salary < salaryArray.length-1){
            String array = salaryArray[salary];
            Integer s1=0,s2=0;
            String[] split = array.split("-");
            s1=Integer.parseInt(split[0]);
            String[] ks = split[1].split("k");
            s2=Integer.parseInt(ks[0]);
            result+="minsalary="+s1*1000+"&"+"maxsalary="+s2*1000+"&";
        }else
            result+=salaryArray[salary]+"&";

        if(degree>0 && degree<degreeArray.length)
            result+="degree="+degreeArray[degree]+"&";

        if(companyType >0 && companyType <degreeArray.length)
            result+="companyType="+companyTypeArray[companyType]+"&";

        result=result.substring(0,result.length()-1);
        System.out.println(result);
    }
}
